<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>


<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<style type="text/css">
		body, html {width: 100%;height: 100%;margin:0;font-family:"微软雅黑";}
		#allmap{width:100%;height:500px;}
		p{margin-left:5px; font-size:14px;}
	</style>
		<link href="<%=request.getContextPath() %>/resources/img/tea.png" rel="icon">
	
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=2qd0NDw4BPB4OADkRVC23wsUDYr95Ype"></script>
	<title>圆形区域搜索</title>
	<link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/chatTea.css">
	    <link rel="stylesheet" href="<%=request.getContextPath() %>/resources/bootstrap/css/bootstrap.min.css">
	    <script src="<%=request.getContextPath() %>/resources/jquery/jquery-1.11.3.min.js"></script>
		<script src="<%=request.getContextPath() %>/resources/bootstrap/js/bootstrap.min.js"></script>
	 	<script type="text/javascript" src="https://unpkg.com/wangeditor/release/wangEditor.min.js"></script>
		<script src="<%=request.getContextPath() %>/resources/js/map.js"></script>
</head>
<body style="background-image: linear-gradient(to top, #fff,#30A12B); height:1355px;">
	<div class="container-fluid">
		<input id="usersequence" type="text" value='<%=session.getAttribute("usersequence") %>' hidden>
		<input id="nickname" type="text" value='<%=session.getAttribute("nickname") %>' hidden>
		
			<jsp:include page="/WEB-INF/jsp/menu.jsp" />
			<div class="wrapper">
				  <div class="content-main center">
					<div id="allmap"></div>
					<div id="r-result"></div>
				</div>
			</div>
	</div>
</body>
</html>
<script type="text/javascript">
	// 百度地图API功能
	var map = new BMap.Map("allmap");
	var point = new BMap.Point(116.331398,39.897445);
	map.centerAndZoom(point,12);

	var geolocation = new BMap.Geolocation();
	geolocation.getCurrentPosition(function(r){
		if(this.getStatus() == BMAP_STATUS_SUCCESS){
			var mk = new BMap.Marker(r.point);
			map.addOverlay(mk);
			map.panTo(r.point);
			alert('您的位置：'+r.point.lng+','+r.point.lat);
			
			//添加地图类型控件
			map.addControl(new BMap.MapTypeControl({
				mapTypes:[
		            BMAP_NORMAL_MAP,
		            BMAP_HYBRID_MAP
		        ]}));	  
			map.setCurrentCity("济南");          // 设置地图显示的城市 此项是必须设置的
			map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
			var mPoint = new BMap.Point(r.point.lng, r.point.lat);  
			var circle = new BMap.Circle(mPoint,10000,{fillColor:"blue", strokeWeight: 1 ,fillOpacity: 0.3, strokeOpacity: 0.3});
		    map.addOverlay(circle);
		    var local =  new BMap.LocalSearch(map, {renderOptions: {map: map, panel: "r-result"}});  
		    local.searchNearby('茶',mPoint,10000);
		}
		else {
			alert('failed'+this.getStatus());
		}        
	},{enableHighAccuracy: true})
	
</script>

